﻿<UserControl x:Class="XAMLMagicks.UserControls.TextBlockUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:u="clr-namespace:XAMLMagicks.UserControls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <StackPanel>
            <TextBlock Text="{Binding Text, TargetNullValue='My value is controlled by a dependency property.', RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type u:TextBlockUserControl}}}"
                       TextWrapping="Wrap" 
                       />
            <TextBlock Text="{Binding Text, ElementName=TextBoxOne}"
                       TextWrapping="Wrap"
                       />
            <TextBox x:Name="TextBoxOne"
                     Text="You can set this text from the first text box."
                     />
            <TextBox x:Name="TextBoxTwo"
                     />
        </StackPanel>
    </Grid>
</UserControl>
